import request from '@/config/axios'

// 获取待办列表
export const getMytodoList = async () => {
  return await request.get({
    url: '/ict/project/project-todo-task-list',
  })
}

// 全部项目页-批量获取项目流程阶段
export const getProjectStage = async (data) => {
  return await request.post({
    url: '/ict/project/project-process-list-by-project-code',
    data
  })
}

// 获取审批流程信息
export const getApprovalProcessList = async (params) => {
  return await request.get({
    url: '/bpm/task/list-by-process-instance-id',
    params
  })
}

export const agreeAccepterProcess = async (data) => {
  return await request.put({
    url: '/ict/transfer/transfer-approve-ict',
    data
  })
}

// 审批流程-同意
export const agreeProcess = async (data) => {
  return await request.put({
    url: '/ict/transfer/transfer-approve',
    data
  })
}

// 审批流程-拒绝
export const refuseProcess = async (data, currentRole) => {
  return await request[`${currentRole === 'accepter' ? 'post' : 'put'}`]({
    url: `/ict/transfer/${currentRole === 'accepter' ? 'communicator-fallback-to-dict' : 'return'}`,
    data
  })
}

// 获取用户列表
export const getUserList = async () => {
  return await request.get({
    url: '/system/user/simple-list',
  })
}
